using System;
using Gtk;

namespace monoServer
{
	public class LoginWindow
	{
		public Window win;
		public Entry entry_username;
		public Entry entry_password;
		public Button button_login;
		public Label entry_errormsg;
		
		public LoginWindow (CommunicatorParallel c)
		{
			this.win = new Window("Anmeldung");
			this.win.Resize(300,150);
			this.entry_password = new Entry();
			this.entry_username = new Entry();
			this.button_login = new Button("Anmelden");
			this.entry_errormsg = new Label();
			
			Table grid = new Table(4,2,false);
			grid.Attach(new Label("Benutzername"),0,1,0,1);
			grid.Attach(this.entry_username,1,2,0,1);
			grid.Attach(new Label("Passwort"),0,1,1,2);
			grid.Attach(this.entry_password,1,2,1,2);
			grid.Attach(this.button_login,0,2,2,3);
			grid.Attach(this.entry_errormsg,0,2,3,4);
			
			this.win.Add(grid);
		}
		
		public void disable()
		{
			this.entry_password.Sensitive = false;
			this.entry_username.Sensitive = false;
			this.button_login.Sensitive = false;
			this.entry_errormsg.Sensitive = false;
		}
		
		public void enable()
		{
			this.entry_username.Sensitive = true;
			this.entry_password.Sensitive = true;
			this.button_login.Sensitive = true;
			this.entry_errormsg.Sensitive = true;
		}
		
		public void show()
		{
			this.win.ShowAll();
		}
		
		public void hide()
		{
			this.win.HideAll();
		}
		
	}
}

